<ul>
<?php
		
	if(isset($cartpoolData) && $cartpoolData["products"]){
		
		$current = "";
		if(isset($cartpoolData["wasSearch"])){
			$current = "current";
		}
		
		$previousRayon = "";
		$i = 0;
		foreach($cartpoolData["products"] as $product){
			if($previousRayon != $product->rayon){
				echo "	<li class='$current rayon'>\n";
				echo "		<a href='#$product->rayon' class='rayon ".strtolower(preg_replace("/[^a-zA-Z]/", "", $product->rayon))."'>$product->rayon</a>\n";
				if($i <= count($cartpoolData["products"])-1){
					echo "		<div>\n";
				}
			}
			echo "			<p><a href=''>$product->name</a></p>\n";
			
			if($i <= count($cartpoolData["products"])-2){
				if($cartpoolData["products"][$i+1]->rayon != $product->rayon){
					echo "		</div>\n";
					echo "	</li>\n";
				}
			}else{
				echo "		</div>\n";
				echo "	</li>\n";
			}
			$i++;
			$previousRayon = $product->rayon;
		}
	}else{
		echo "<li class='no_products_found'>no product found<p><a href='#'>click here</a> or press 'enter' to add a new product.</p></li>";
	}
?>
</ul>